import numpy as np
import pandas as pd
from scipy import interpolate
import matplotlib.pyplot as plt
import math
from sympy import *

data=pd.read_csv("data1.csv")
x=np.array(data['x'])
y=np.array(data['y'])
m=np.array([np.sqrt(xi*xi+yi*yi) for (xi,yi) in zip(x,y)])
h=2
theta=np.array([np.arctan(h/mi) for mi in m])
omega=np.array([np.arctan(yi/xi) for (xi,yi) in zip(x,y)])
# 4.18 - 3.21
phi=math.radians(27*94/365)
c2=116
time=np.array(data['time'])
c1=np.array([c2-np.arcsin(-np.sin(o)*np.cos(t)/np.cos(phi)) for (o,t) in zip(omega,theta)])
print(c1)
print(theta)
t=np.array([int(ti[:2])*60+int(ti[3:])-4*(c2-np.mean(c1)) for ti in time])
f_t=np.array([math.radians((ti-720)/4) for ti in t])
print(f_t[0])


print(cos(omega[0]))
print(sin(theta[0]))
print(cos(theta[0]))
print(cos(f_t[0]))